package com.applet.setmeal.service.impl;


import com.applet.entity.Setmeal;
import com.applet.setmeal.mapper.SetMealMapper;
import com.applet.setmeal.service.SetMealService;
import com.applet.setmealdish.service.SetMealDishService;
import com.applet.vo.DishItemVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 套餐管理 serviceImpl
 */
@Slf4j
@Service
public class SetMealServiceImpl implements SetMealService {

    @Resource
    private SetMealMapper setMealMapper;

    @Resource
    private SetMealDishService setMealDishService;



    /**
     * 套餐管理
     *        根据分类id 查询所有套餐
     * @param categoryId
     */
    @Override
    public List<Setmeal> selectSetMealListByCategoryId(Long categoryId) {
        // 查询所有起售的套餐
        return setMealMapper.selectSetMealListByCategoryId(categoryId);
    }



    /**
     * 套餐管理
     *        根据套餐id 查询套餐关联的菜品集合
     * @param id
     */
    @Override
    public List<DishItemVO> dishInSetMeal(Long id) {
        return setMealDishService.dishInSetMeal(id);
    }



    /**
     * 套餐管理
     *        根据id查询套餐
     * @param id
     */
    @Override
    public Setmeal selectSetMealById(Long id) {
        return setMealMapper.selectSetMealById(id);
    }
}
